package functional;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.util.function.Function;

/**
 * Author:ZouHeng
 * Description:
 * Date:2021-07-05  14:37
 **/
@Getter
@Setter
@AllArgsConstructor
public class FunctionDemo {

    private String num;

    public void change(Function<String, Integer> function) {
        int afterNum = function.apply(this.num);
        System.out.println("转换后的数值为：" + afterNum);
    }

    public void methodAndThen(Function<String, Integer> one, Function<Integer, Integer> two) {
        int afterNum = one.andThen(two).apply(this.num);
        System.out.println("转换后的数值为：" + afterNum);
    }
}
